using System;
using System.Collections.Generic;
using System.Text;
using NBusiness.CodeDom.Compiler;
using System.Resources;

namespace NBusiness.ESharp.Compiler
{
    [Serializable]
    internal class ESharpBuildError : EntityBuildError
    {
        #region Static and constant
        private static ResourceManager _manager;

        static ESharpBuildError()
        {
            _manager = new ResourceManager("NBusiness.ESharp.Properties.Resources", typeof(ESharpBuildError).Assembly);
        } 
        #endregion

        #region Constructors
        public ESharpBuildError(ESharpErrorCode errorCode, EntityElement element, EntityBuildErrorType errorType, params string[] parameters)
            : this(
            errorCode.ToString(),
            string.Format(_manager.GetString(errorCode.ToString()), parameters),
            element,
            errorType)
        { }

        public ESharpBuildError(ESharpErrorCode errorCode, EntityElement element, params string[] parameters)
            : this(
            errorCode.ToString(),
            string.Format(_manager.GetString(errorCode.ToString()), parameters),
            element,
            EntityBuildErrorType.Error)
        { }

        protected ESharpBuildError(string errorCode, string message, EntityElement element, EntityBuildErrorType type)
            : base(errorCode, message, element, type)
        { } 
        #endregion
    }
}
